<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(["namespace" => "App\Http\Controllers\Api\V1", "prefix" => "v1"], function () {
    // Mes
    Route::group(["namespace" => "Mes", "prefix" => "mes"], function () {
        Route::post("login", "LoginController@login");  // 登录


        // 菜单权限
        Route::get("auth-menus", "AuthMenuController@list");    // 列表
        Route::post("create-auth-menu", "AuthMenuController@create");   // 新增
        Route::post("modify-auth-menu", "AuthMenuController@modify");   // 修改
        Route::post("delete-auth-menu", "AuthMenuController@delete");   // 删除

        // 角色
        Route::get("auth-roles", "AuthRoleController@list");    // 列表
        Route::post("create-auth-role", "AuthRoleController@create");   // 新增
        Route::post("modify-auth-role", "AuthRoleController@modify");   // 修改
        Route::post("delete-auth-role", "AuthRoleController@delete");   // 删除
        Route::get("auth-role-users", "AuthRoleController@users");   // 用户列表

        // 用户
        Route::get("auth-users", "AuthUserController@list");    // 列表
        Route::post("create-auth-user", "AuthUserController@create");   // 新增
        Route::post("modify-auth-user", "AuthUserController@modify");   // 修改
        Route::post("delete-auth-user", "AuthUserController@delete");   // 删除

        // 客户
        Route::get("customers", "CustomerController@list"); // 列表
    });
});
